package com.yuanyu.controller;

import com.yuanyu.common.util.ResultInfoUtil;
import com.yuanyu.model.vo.*;
import com.yuanyu.server.ITestPart1Server;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

//@CrossOrigin(allowCredentials = "true", allowedHeaders = "*")
@RestController
@RequestMapping("/part1")
public class TestPart1Controller {
    @Autowired
    private ITestPart1Server testPart1Server;

    @GetMapping("/test")
    public ResultInfo test(){
        System.out.println("这是测试界面");
        return ResultInfoUtil.buildSuccess(testPart1Server.test());
    }
    @PostMapping("/add")
    public ResultInfo part(@RequestBody Initial_maintenance_inspection_reportVO initialMaintenanceInspectionReportVO){
        System.out.println(initialMaintenanceInspectionReportVO.toString());
        return ResultInfoUtil.buildSuccess(testPart1Server.test1(initialMaintenanceInspectionReportVO));
    }
    @GetMapping("/value/{Case}")
    public ResultInfo partValue(@PathVariable("Case") String Case){
        System.out.println(Case);
        return ResultInfoUtil.buildSuccess(testPart1Server.getTest1(Case));
    }
    @PostMapping("/update")
    public ResultInfo updatePart(@RequestBody Initial_maintenance_inspection_reportVO initialMaintenanceInspectionReportVO){
        System.out.println(initialMaintenanceInspectionReportVO.toString());
        return ResultInfoUtil.buildSuccess(testPart1Server.updateTable1(initialMaintenanceInspectionReportVO));
    }
    @GetMapping("/selPage/{page}")
    public ResultInfo selPage( @PathVariable("page") Integer page){
        return ResultInfoUtil.buildSuccess(null);
    }
}
